Skip to content

feat: 支持管理番剧种子和孤儿种子#1020

Open
zhushanwen321 wants to merge 21 commits into
EstrellaXD:3.2-devfrom
zhushanwen321:feat/torrent-management
Open

feat: 支持管理番剧种子和孤儿种子#1020
zhushanwen321 wants to merge 21 commits into
EstrellaXD:3.2-devfrom
zhushanwen321:feat/torrent-management

Conversation

@zhushanwen321
Copy link
Copy Markdown

@zhushanwen321 zhushanwen321 commented Apr 7, 2026

解决什么问题

torrent 表会积累大量"孤儿种子"(bangumi_id 为 NULL 的记录)。这些种子可能来自解析失败的 RSS 条目、手动添加后取消关联的番剧、或者重复收集时残留的脏数据。

目前用户遇到这些问题没有任何操作入口,只能手动去数据库里删。相关反馈:

做了什么

后端:给 bangumi 路由组加了 8 个种子管理接口(查看/删除/清空),孤儿删除走 DELETE ... WHERE bangumi_id IS NULL 批量操作。

前端

  • 番剧列表页末尾加了一个 "Others" 卡片,有孤儿种子时显示数量角标,点进去可以查看和管理
  • 新增两个种子列表页(番剧种子 / 孤儿种子),支持多选、批量删除、清空所有
  • 顺手修了 mikan_parser 在海报元素缺失或图片下载失败时的崩溃问题

页面预览

  • 番剧列表 — Others 卡片(带角标)
orphan-torrent-bangumi
  • 孤儿种子列表 — 多选 + 批量删除
orphan-torrents
  • 清空确认弹窗
delete-all-orphan-torrents

测试要点

  • 有孤儿种子时 Others 卡片出现,角标数字正确
  • 点进去能看到孤儿种子列表,多选删除和清空正常
  • 某个番剧的种子列表也能正常查看和删除
  • 删完后 Others 卡片消失(数量归零)
  • mikan RSS 海报加载失败时不再崩溃

EstrellaXD and others added 20 commits March 1, 2026 08:22
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add root_path None check
- Add IndexError protection for poster_style parsing
- Show complete official_title_parser method with re.sub cleanup
- Clarify _mikan_cache growth is out of scope

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…erwrite

mikan_parser crashes on any None value from network failures or page
structure changes, and caches failed results permanently. This causes
bangumi records to be created with degraded titles that never recover.

Changes:
- mikan_parser: add None checks for get_html, soup.find, soup.select_one
- mikan_parser: add root_path validation and IndexError protection
- mikan_parser: only cache successful results (not failures)
- analyser: conditional assignment to avoid overwriting raw_parser fallback

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix route conflict: orphans must register before {id}/torrents
- Add torrent ownership check for single delete endpoint
- Expand Torrent type with bangumi_id/rss_id fields
- Define API response format for all endpoints
- Clarify Others card uses route navigation, not inline

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Document u_response behavior (no status field, consistent with existing)
- Add definePage() to page components for consistency
- Concrete Others card implementation with styles
- Fix i18n key prefix to use homepage.* (matching existing convention)
- Clarify route coexistence with bangumi.vue

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove redundant inline ResponseModel imports (already in top-level)
- Use onActivated instead of onMounted in torrent pages (KeepAlive compat)
- Add confirm dialog before delete-all action

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
unplugin-vue-router treats bangumi/ subdirectories as nested routes
requiring a <RouterView> in bangumi.vue. Since bangumi.vue has no
router-view, these pages were invisible after navigation.

Move to bangumi-torrents/ as independent routes under pages/index/.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix Others card badge clipped (overflow: hidden → visible)
- Fix torrent pages not scrollable (flex layout + overflow-y: auto)
- Add checkbox multi-select and batch delete
- Move toolbar to top with select-all, batch-delete, clear-all buttons
- Replace native confirm() with ab-popup dialog
- Add error handling via useTorrentList composable
- Add backend GET /torrents/orphans/count endpoint for lightweight count
- Extract shared logic into useTorrentList composable
- Unify i18n usage across both torrent pages

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move execDeleteAll declaration before handleDeleteAll usage
to resolve @typescript-eslint/no-use-before-define error.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Extract shared AbTorrentListPage component to deduplicate bangumi
  and orphan torrent pages (~240 lines of duplicate template+style)
- Remove unused ab-torrent-list.vue component (214 lines dead code)
- Fix useTorrentList hook: use project's auto-imported useMessage
  instead of naive-ui direct import, remove unused message export
- Optimize delete_orphans to use bulk DELETE SQL instead of
  select-all-then-delete-one-by-one
- Use .is_(None) instead of == None for SQLAlchemy NULL comparisons
- Add delete_obj method to avoid redundant double search in
  single-torrent delete API endpoints
- Replace all hardcoded Chinese strings with i18n keys

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 7, 2026

@zhushanwen321 is attempting to deploy a commit to the estrellaxd's projects Team on Vercel.

A member of the Team first needs to authorize it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@zhushanwen321 zhushanwen321 changed the title feat: add torrent management for bangumi and orphan torrents feat: 支持管理番剧种子和孤儿种子 Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants